﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入第一个数字:");
            string s1 = Console.ReadLine();
            Console.WriteLine("请输入第二个数字:");
            string s2 = Console.ReadLine();
            Console.WriteLine("请输入运算符:");
            char c = (char)Console.Read();
            double a = double.Parse(s1);
            double b = double.Parse(s2);
            double end = 1d;
            switch (c)
            {
                case '*':
                    end = a * b;
                    break;
                case '+':
                    end = a + b;
                    break;
                case '-':
                    end = a - b;
                    break;
                case '/':
                    if (b == 0)
                    {
                        Console.WriteLine("除数为0!");
                    }
                    else
                    {
                        end = a / b;
                    }
                    break;
                case '^':
                    for(int i = 0; i < b; i++)
                    {
                        end *= a;
                    }
                    break;
            }
            Console.WriteLine("计算的结果为:" + end);
        }
    }
}
